﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO.Ports;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace SerialAssistant
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        public Action<string> sendData; 

        private void btnSend_Click(object sender, EventArgs e)
        {
            sendData?.Invoke(textBox.Text);
        }

        private void Form1_Load(object sender, EventArgs e)
        {
        }

        public void jieshou(byte[] temp)
        {
            this.Invoke(new Action(() =>
            {

                richTextBox.AppendText(Encoding.GetEncoding("gb2312").GetString(temp));

            }));
        }

        public void jieshou2(object sender, TestHander e)
        {
            MessageBox.Show(e.MyData.ToString());
        }
    }
}
